blob: c3be68f06cf007c530c734feea56a35fed414abd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import invoice from "$lib/invoice";
import getRates from "$lib/rates";
import { redirect } from "@sveltejs/kit";
export async function load({ parent }) {
const rates = await getRates();
const { invoice, subject } = await parent();
if (!invoice.amount) redirect(307, `/invoice/${invoice.id}`);
const rate = rates[subject?.currency];
const invoiceRate = rates[invoice.currency];
return { rate, invoiceRate };
}
export const actions = {
default: invoice,
};
|